home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / MAIL.SWG / 0003_RemoteAccess Security Edit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  4.4 KB  |  141 lines

  1. {
  2. 16 Dec 95 18:41, Adam Rutter wrote to Martin Woods:
  3.  AR> ok, well I wanted to know how to CREATE an account in the RA
  4.  AR> userbase.. sorry if I was unclear.. I said I wanted to know both,
  5.  AR> but I know how to read from it already.. if you could post some
  6.  AR> source on creating a user record I would appreciate it... thanks.
  7.  
  8. { This is similar to the viewer except it will allow editing of the security
  9. level and writes the new value to the users.bbs,using this as a guide you
  10. could edit each of the other fields in the same way,I would suggest you copy
  11. a users.bbs file into the current work dir to play with first: see main below
  12. }
  13. Program RA_Security_Edit;
  14. Uses Crt, Dos;
  15. {$I c:\ra\STRUCT.200}
  16. Var
  17.    UserRec : USERSrecord;
  18.    UserFile : File of USERSrecord;
  19.    SysPath,UserPath,ConfigPath : String;
  20.    SysRec: CONFIGrecord;
  21.    SysFile : File of CONFIGrecord;
  22.    X,a : Integer;
  23.    Done : Boolean;
  24.    Ch : Char;
  25.  
  26. Function FixPath(Path : String): String;
  27.   Begin
  28.     If Path[Length(Path)] <> '\' Then
  29.         Path := Path+'\';
  30.      FixPath := Path;
  31.    End;
  32.  
  33. procedure drawscreen;
  34. begin;
  35.    textattr:=14;
  36.    gotoxy(25,1);
  37.    write(' Remote Access Security Edit');
  38.    textattr:=$01;
  39.    gotoxy(1,2);
  40.    for a:=1 to 80 do write('═');
  41.    gotoxy(1,23);
  42.    for a:=1 to 80 do write('─');
  43.    textattr:=15;
  44.    gotoxy(3,24);
  45.    Write('(PgUp) Last User    (PgDn) Next User    (C)hange Security   (ESC)
  46. Exit');end;
  47.  
  48. Procedure Write_New_Record;
  49.   begin
  50.     gotoxy(2,24);clreol;
  51.     write('Levels: [L]ockout, [U]nvalidated, [R]egular, [V]ip, [S]ysop. ?');
  52.     repeat ch := upcase(readkey) until ch in ['L','U','R','V','S'];
  53.       case ch of
  54.         'L' : UserRec.security := 0;
  55.         'U' : UserRec.security := 10;
  56.         'R' : UserRec.security := 150;
  57.         'V' : UserRec.security := 2000;
  58.         'S' : UserRec.security := 65535;
  59.       end;
  60.           gotoxy(1,24); clreol;
  61.           writeln('Writing User File One Moment...');
  62.           delay(450);
  63.           {$I-}
  64.           seek(userfile,X);
  65.           write(userfile,UserRec);
  66.           {$I+}
  67.        end;
  68.  
  69. Begin {main}
  70.    ClrScr;
  71.    SysPath := GetEnv('RA');           {[drive]:\RA}
  72.        SysPath := Fixpath(SysPath);   {[drive]:\RA\}
  73.        ConfigPath := SysPath + 'CONFIG.RA'; {[drive]:\RA\CONFIG.RA}
  74.  
  75.    {$I-}
  76.    Assign(SysFile,ConfigPath);
  77.    Reset(SysFile);
  78.     {$I+}
  79.     If IOresult <> 0 then Begin
  80.     WriteLn(' Error Reading ',ConfigPath);
  81.     WriteLn(' Exiting with Errorlevel 1');
  82.     Halt(1);  {Exit at errorlevel 1,[drive]:\RA\CONFIG.RA not Found}
  83.     End;      {Is the enviroment variable set?}
  84.  
  85.    read(SysFile,SysRec); {open up CONFIG.RA and find the Path to the}
  86.                          { Messsage base,(where users.bbs is stored) }
  87.    Close(SysFile);
  88.    UserPath := FixPath(SysRec.MsgBasePath);
  89.    UserPath:=UserPath + 'USERS.BBS';
  90.    {$I-}
  91. > Assign(UserFile,{UserPath}'USERS.BBS'); { <- Copy a USERS.BBS file into the
  92. } Reset(UserFile);                        { current dir to play with before
  93. }   {$I+}                                 { you comment out UserPath
  94. }    If IOresult <> 0 then Begin
  95.      WriteLn(' Error Reading ',UserPath);
  96.      WriteLn(' Exiting with Errorlevel 2');
  97.      Halt(2);{Exit At Errorlevel 2,[drive]:\Msgbase\Users.bbs not found}
  98.     End;
  99.    X := 0;
  100.    Done := False;
  101. Repeat
  102.    textattr:=$07;
  103.    ClrScr;
  104.    Seek(UserFile, X);
  105.    Read(UserFile, UserRec);
  106.    gotoxy(1,3);
  107.    with UserRec do
  108.    Begin
  109.    Writeln;
  110.    Writeln('  User #    : ',X+1);
  111.    Writeln('  Name      : ',Name);
  112.    Writeln('  Handle    : ',Handle);
  113.    WriteLn('  Security  : ',Security);
  114.    WriteLn('  Location  : ',Location);
  115.    WriteLn('  Data #    : ',DataPhone);
  116.    WriteLn('  Home #    : ',VoicePhone);
  117.    WriteLn('  Birthday  : ',BirthDate);
  118.    Write('  Last Call : ',LastDate);
  119.    WriteLn(' ',Lasttime);
  120.           case Sex of
  121.                1 : writeln ('  Sex       : Male');
  122.                2 : writeln ('  Sex       : Female');
  123.               else writeln ('  Sex       : Unknown');
  124.             end;
  125.    writeln('  Number of Calls :',NoCalls);
  126.    end; {with}
  127.     drawscreen;
  128.     Ch := Readkey;
  129.    if (ch=#0) then ch:=upcase(readkey);
  130.    Case ch Of
  131.      #81 : If X < FileSize(UserFile)-1 Then Inc(X);
  132.      #73 : If X > 0 Then Dec(X);
  133.      #27 : Done := True;
  134.      #99 {'C'} : Write_New_Record;
  135.  end;
  136.    Until done;
  137.     Close(UserFile);
  138.     textattr:=$07;
  139.     clrscr;
  140.  End.
  141.